<template>
  <div>
    <!-- 头部 -->
    <MyHeader
      background="#1d7bff"
      title="TabBar案例"
    ></MyHeader>
    <!-- 主体 -->
    <div class="main">
      <keep-alive>
        <component :is="isCom"></component>
      </keep-alive>
    </div>

    <!-- 底部导航 -->
    <MyTabBar
      :arr='tabList'
      @component='comFn'
    ></MyTabBar>
  </div>
</template>

<script>
import MyHeader from './components/MyHeader'
import MyTabBar from './components/MyTabBar'
import MyGoodsList from './views/MyGoodsList'
import MyUserInfo from './views/MyUserinfo'
import MyGoodsSearch from './views/MyGoodsSearch'
export default {
  components: {
    MyHeader,
    MyTabBar,
    MyGoodsList,
    MyGoodsSearch,
    MyUserInfo
  },
  data () {
    return {
      tabList: [
        {
          iconText: "icon-shangpinliebiao",
          text: "商品列表",
          componentName: "MyGoodsList"
        },
        {
          iconText: "icon-sousuo",
          text: "商品搜索",
          componentName: "MyGoodsSearch"
        },
        {
          iconText: "icon-user",
          text: "我的信息",
          componentName: "MyUserInfo"
        }
      ],
      isCom: 'MyGoodsList'
    }
  },
  methods: {
    comFn (com) {
      // console.log(com);
      this.isCom = com
    }
  }
}
</script>

<style scoped>
.main {
  padding: 45px 0 51px 0;
}
</style>